#主动技能【动力阀门】
execute as @a[tag=jueling] unless data entity @s Inventory[{Slot:-106b,id:"minecraft:firework_rocket",Count:1b}] unless data entity @s Inventory[{Slot:-106b,id:"minecraft:redstone_torch",Count:1b}] run function nw:yingxiong/3yingxiong/05jueling/skill/1donglifamen
#主动技能【动力阀门】CD
execute as @a[tag=jueling,scores={skCDPearl=0}] if data entity @s Inventory[{Slot:-106b,id:"minecraft:redstone_torch",Count:1b}] run function nw:yingxiong/3yingxiong/05jueling/skill/1donglifamen_cd
#主动技能【动力阀门】当没有火箭和存储时清空背包内火箭
execute as @a[tag=jueling] unless data entity @s Inventory[{Slot:-106b,id:"minecraft:firework_rocket",Count:1b}] unless score @s skCDPearl matches 0 run clear @s firework_rocket

#主动技能【能源补给】
execute as @a[tag=jueling,scores={skSnowball=1..}] run function nw:yingxiong/3yingxiong/05jueling/skill/2nengyuan
#主动技能【能源补给】CD
execute as @a[tag=jueling,scores={skCDEgg=0}] run function nw:yingxiong/3yingxiong/05jueling/skill/2nengyuan_cd

#主动技能【过载释放】地面释放效果
execute as @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=..0}] at @s rotated ~ 0 run summon minecraft:fireball ^ ^1.5 ^-2 {Motion:[0.0,-1.0,0.0],ExplosionPower:1.8b}
execute as @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=..0}] at @s rotated ~ 0 run summon minecraft:potion ^ ^1.5 ^-2 {Motion:[0.0,-1.0,0.0],Item:{id:"minecraft:lingering_potion",Count:1b,tag:{CustomPotionColor:1273870,Item:CBC,CustomPotionEffects:[{Id:19,Amplifier:3,Duration:80}]}}}
effect give @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=..0}] minecraft:speed 1 1 true
effect give @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=..0}] minecraft:weakness 1 0 true
effect give @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=..0}] minecraft:resistance 1 1 true
#主动技能【过载释放】空中释放效果（未超负荷）
execute as @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=1..,skFlyDistance=..15000}] at @s rotated ~ 0 run summon minecraft:fireball ^ ^-3 ^2.5 {Motion:[0.0,-2.0,0.0],ExplosionPower:1.8b}
execute as @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=1..,skFlyDistance=..15000}] at @s rotated ~ 0 run summon minecraft:potion ^ ^-3 ^2.5 {Motion:[0.0,-1.0,0.0],Item:{id:"minecraft:lingering_potion",Count:1b,tag:{CustomPotionColor:50439,Item:CBC,CustomPotionEffects:[{Id:19,Amplifier:3,Duration:80}]}}}
#主动技能【过载释放】空中释放效果（已超负荷）
execute as @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=1..,skFlyDistance=15001..}] at @s rotated ~ 0 run summon minecraft:fireball ^ ^-2 ^2.5 {Motion:[0.0,-2.0,0.0],ExplosionPower:2}
execute as @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=1..,skFlyDistance=15001..}] at @s rotated ~ 0 run summon minecraft:potion ^ ^-2 ^2.5 {Motion:[0.0,0.0,0.0],Item:{id:"minecraft:lingering_potion",Count:1b,tag:{CustomPotionColor:7938938,Item:CBC,CustomPotionEffects:[{Id:19,Amplifier:3,Duration:80},{Id:20,Amplifier:4,Duration:80}]}}}

effect give @a[tag=jueling,scores={skCDKe=10..,skCDEntity1=1..,skPlayer=1..,skFly=200..}] minecraft:slowness 1 1 true
execute as @a[tag=jueling,scores={skCDPlayer=1..,skCDEntity1=1..,skPlayer=1..}] run scoreboard players remove @s skPlayer 1

#主动技能【过载释放】
execute as @a[tag=jueling,scores={skEXBottle=1..}] run function nw:yingxiong/3yingxiong/05jueling/skill/3guozai
#主动技能【过载释放】CD
execute as @a[tag=jueling,scores={skCDEXBottle=0}] run function nw:yingxiong/3yingxiong/05jueling/skill/3guozai_cd

#被动技能【过载能源】过载加强
effect give @a[tag=jueling,scores={skPlayer=1..2}] speed 1 0 true
effect give @a[tag=jueling,scores={skPlayer=3..}] speed 1 1 true
effect give @a[tag=jueling,scores={skPlayer=3..}] jump_boost 1 2 true
effect give @a[tag=jueling,scores={skPlayer=6}] levitation 1 4 true
clear @a[tag=jueling,scores={skPlayer=6}] elytra
item replace entity @a[tag=jueling,scores={skPlayer=6}] armor.chest with minecraft:leather_chestplate{Unbreakable: 1, display: {color: 16777215}} 1
scoreboard players remove @a[tag=jueling,scores={skPlayer=6}] skPlayer 2

#被动技能【过载能源】修复“滑翔喷气机”
execute as @a[tag=jueling,scores={skPlayer=0}] if data entity @s Inventory[{Slot:102b,id:"minecraft:leather_chestplate",Count:1b}] run item replace entity @s armor.chest with minecraft:elytra{display: {Name: '[{"text":"滑翔喷气机","color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]'}, Unbreakable: 1} 1
scoreboard players set @a[tag=jueling,scores={skPlayer=0}] skPlayer -1

#被动技能【新鲜空气】
effect clear @a[tag=jueling] poison
execute as @a[tag=jueling,scores={skFly=1400..1600}] run effect give @s regeneration 4 1 true
execute as @a[tag=jueling,scores={skFly=1400..1600}] run effect give @s saturation 1 0 true
execute as @a[tag=jueling,scores={skFly=1400..1600}] run effect clear @s slowness
execute as @a[tag=jueling,scores={skFly=1400..1600}] run effect clear @s weakness
execute as @a[tag=jueling,scores={skFly=1..}] at @s unless block ~ ~-0.1 ~ air run scoreboard players set @s skFly 0

#被动技能【超负荷】控制负荷至少为0
scoreboard players set @a[tag=jueling,scores={skFlyDistance=..-1}] skFlyDistance 0
#被动技能【超负荷】过热状态
effect give @a[tag=jueling,scores={skFlyDistance=15001..,skFly=0}] slowness 4 3 true
effect give @a[tag=jueling,scores={skFlyDistance=15001..,skFly=0}] mining_fatigue 4 2 true
scoreboard players set @a[tag=jueling,scores={skFlyDistance=15001..,skFly=0}] skFly -1

#被动技能【超负荷】未启动“滑翔喷气机”减负荷
execute as @a[tag=jueling,scores={skFly=..0,skFlyDistance=1..}] run scoreboard players remove @s skFlyDistance 50
execute as @a[tag=jueling,scores={skFly=-1,skCDPlayer=1..,skFlyDistance=1..}] run scoreboard players remove @s skFlyDistance 3000
execute as @a[tag=jueling,scores={skFly=-1,skFlyDistance=0}] run scoreboard players set @s skFly 0
#被动技能【负荷气体】
effect give @a[tag=jueling,scores={skCDPlayer=1..,skFlyDistance=15001..,skFly=1..}] minecraft:instant_damage 1 0 true
execute as @a[tag=jueling,scores={skFlyDistance=15001..,skFly=1..,skCDEntity1=0}] at @s run summon minecraft:area_effect_cloud ~ ~-1 ~ {Effects:[{Id:20,Amplifier:3,Duration:40}],WaitTime:0,ReapplicationDelay:5,Age:10,Duration:100,DurationOnUse:0,Color:0,Radius:1,RadiusPerTick:0.035f}

#清空秒与刻
scoreboard players set @a[tag=jueling,scores={skCDPlayer=1..}] skCDPlayer 0
scoreboard players reset @a[tag=jueling,scores={skCDKe=10..}] skCDKe

#坠机
execute as @a[tag=jueling,scores={skFlyDistance=15000..},nbt={DeathTime:1s}] run title @s title [{"text":"极限越负荷","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscased":false}]
execute as @a[tag=jueling,scores={skFlyDistance=15000..},nbt={DeathTime:1s}] run title @s subtitle [{"text":"滑翔喷气机损坏，已坠机","color":"green","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" —超负荷","color":"black","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
execute as @a[tag=jueling,scores={skFlyDistance=15000..},nbt={DeathTime:1s}] run tellraw @a [{"selector":"@s","color":"yellow","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"在飞行中","color":"white","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"超负荷后","color":"dark_purple","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"坠机了","color":"white","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]

#C05绝翎（滑翔者）
execute as @a[tag=jueling] run title @s actionbar [{"text":"动力阀门","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDPearl","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 能源补给","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDEgg","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 过载释放","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDEXBottle","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 过载 ","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skPlayer","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"/","color":"dark_red","bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"5","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 负荷 ","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skFlyDistance","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"/","color":"dark_red","bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"15000","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
